home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / misc / FlyBot.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.7 KB  |  79 lines

  1. class classes.misc.FlyBot
  2. {
  3.    var x;
  4.    var y;
  5.    var clip;
  6.    var c = 0;
  7.    var xMov = 0;
  8.    var yMov = 0;
  9.    var xMovT = 0;
  10.    var yMovT = 0;
  11.    var hc = 0;
  12.    var xA = 0;
  13.    var yA = 0;
  14.    var Name = "flyBot";
  15.    function FlyBot(px, py)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.clip = _root.attachMovie("flyBot","flyBotClip",90010);
  20.       this.clip._x = this.x;
  21.       this.clip._y = this.y;
  22.       this.xMov = this.xMovT = 3;
  23.       _root.introScreen.littleDoorBlack._visible = true;
  24.       _root.introOverlay.highDoor.gotoAndPlay("open");
  25.    }
  26.    function main()
  27.    {
  28.       this.c = this.c + 1;
  29.       if(this.c == 60)
  30.       {
  31.          _root.introOverlay.highDoor.gotoAndPlay("close");
  32.       }
  33.       if(this.c == 75)
  34.       {
  35.          _root.introScreen.highDoorBlack._visible = false;
  36.          _root.introOverlay.highDoor._visible = false;
  37.       }
  38.       if(this.xMovT < this.xMov)
  39.       {
  40.          this.xMov -= 0.5;
  41.       }
  42.       else if(this.xMovT > this.xMov)
  43.       {
  44.          this.xMov += 0.5;
  45.       }
  46.       else
  47.       {
  48.          this.xMov = this.xMovT;
  49.       }
  50.       if(this.yMovT < this.yMov)
  51.       {
  52.          this.yMov -= 0.5;
  53.       }
  54.       else if(this.yMovT > this.yMov)
  55.       {
  56.          this.yMov += 0.5;
  57.       }
  58.       else
  59.       {
  60.          this.yMov = this.yMovT;
  61.       }
  62.       if(random(100) > 98)
  63.       {
  64.          this.clip.body.eyes.clip.gotoAndPlay("blink");
  65.       }
  66.       this.x += this.xMov + this.xA;
  67.       if(this.c < 15)
  68.       {
  69.          this.y += this.yMov + this.yA;
  70.       }
  71.       else
  72.       {
  73.          this.y += this.yMov + this.yA + 0.3 * Math.sin(this.hc += 0.1);
  74.       }
  75.       this.clip._x = this.x;
  76.       this.clip._y = this.y;
  77.    }
  78. }
  79.